import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';

import 'take_photo_platform_interface.dart';

/// An implementation of [TakePhotoPlatform] that uses method channels.
class MethodChannelTakePhoto extends TakePhotoPlatform {
  /// The method channel used to interact with the native platform.
  @visibleForTesting
  final methodChannel = const MethodChannel('take_photo');

  @override
  Future<String?> getPlatformVersion() async {
    final version =
        await methodChannel.invokeMethod<String>('getPlatformVersion');
    return version;
  }

  @override
  Future<String?> takePhoto() async {
    final photo = await methodChannel.invokeMethod<String>('takePhoto');
    return photo;
  }

  @override
  Future<String?> takeVideo() async {
    final video = await methodChannel.invokeMethod<String>('takeVideo');
    return video;
  }

  @override
  Future<void> openCamera() async {
    await methodChannel.invokeMethod<void>('openCamera');
  }
}
